<%-- 
    Document   : ListaUsuarios
    Created on : 1/04/2011, 10:23:17 AM
    Author     : Jhon
--%>

<%@page import="java.util.List"%>
<%@page import="control.Controller"%>
<%@page import="vo.VOUser"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="HTML.*"%>
<%@include file="CheckSession.jsp"%>
<% HtmlBody b = new HtmlBody("Users - Users List","");
   HtmlContent c = new HtmlContent("Users List");
   VOUser a = (VOUser) session.getAttribute("USER");
   if(a.isIsAdmin()){
   b.addUsuario(a.getHandle(), "Administrator");
   }else{
   b.addUsuario(a.getHandle(), "User");
   }
   HtmlSideBar s = new HtmlSideBar(true);
   c.addSearchU("Search Users", "Usuario/BuscarUsuarios.jsp");
  Controller con = Controller.getInstance();
    List<VOUser> list = con.listUsers();
   if(list!=null && !list.isEmpty()){
      String[] datos ={"Handle","First Name","Last Name","Institution"};
       c.addInitLista("Users","600", datos);
      for(VOUser u: list){
        if(!u.isIsAdmin()){
        datos[0]=u.getHandle();
        datos[1]=u.getFirstName();
        datos[2]=u.getLastName();
        datos[3]=u.getInstitution();
        c.addDataLista(datos);}
   }

   }
   c.addEndLista();
   b.addContent(c.getContent());
   b.addSideBar(s.getBar());
    %>

    <%=b.getHtml()%>